VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "ShowForm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Option Explicit

Public SFrmName As Object
Public lSuccess As Boolean

Public MDI As Object

Public Function ShowForm(sFRM As String) As Boolean
    On Error GoTo ErrHandler
    Dim sOBJ As Object
    
    Dim lFind As Boolean
    For Each sOBJ In Forms
        If sOBJ.Name = sFRM Then
            Set oMDI = MDI
            sOBJ.Show
            sOBJ.TBReload
            Set SFrmName = sOBJ
            lFind = True
            lSuccess = True
        End If
    Next
    
    If lFind = False Then
        Set oMDI = MDI
        Set sOBJ = Forms.Add(sFRM)
        sOBJ.Show
        Set SFrmName = sOBJ
        lSuccess = True
    End If
    Set sOBJ = Nothing
    
ErrHandler:
    If Err.Number = 424 Then
        MsgBox "Missing Form/Component: " & sFRM
        lSuccess = False
    End If
End Function

Public Function CloseForm(sFRM As String) As Boolean
    On Error GoTo ErrHandler
    Dim sOBJ As Object
    
    Dim lFind As Boolean
    For Each sOBJ In Forms
        If sOBJ.Name = sFRM Then
            Set oMDI = MDI
            sOBJ.TBCloseWindow
            Set SFrmName = sOBJ
            lFind = True
            lSuccess = True
        End If
    Next
    
    If lFind = False Then
        Set oMDI = MDI
        Set sOBJ = Forms.Add(sFRM)
        sOBJ.TBClose
        Set SFrmName = sOBJ
        lSuccess = True
    End If
    Set sOBJ = Nothing
    
ErrHandler:
    If Err.Number = 424 Then
        MsgBox "Missing Form/Component: " & sFRM
        lSuccess = False
    End If
End Function




